// lessoncom/commit/commit.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
   subStyle:{
     type:String
   },
   holder:{
     type:String,
     value:'一起来讨论吧~'
   },
   commitFocus:{
     type:Boolean,
     value:false
   }

  },

  /**
   * 组件的初始数据
   */
  data: {
     sub:true,
     value:'',
     commitFocus1:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
   submit:function(event){
     var sub=this.data.sub
     var v=this.data.value
     let that=this
     if(v==''){
       wx.showToast({
         title: '发送的内容不能为空',
          icon:'none'
       })
     }else{
       this.triggerEvent('submit', { sub, v })
       this.setData({
         value: ''
       })
       wx.showToast({
         title: '发送成功',
       })
      that.setData({
        commitFocus1:that.properties.commitFocus
      })
     }

   },
   outValue:function(e){
     //console.log(e.detail.value)
     this.setData({
       value:e.detail.value
     })
   }
  }
})
